<template>
 <div class="app-main">
  <AppHeader class="app-common__header">
    <template #left>
      <van-icon name="apps-o" />
    </template>
    <template #title>
      <van-search
        shape="round"
        background="#b83627"
        placeholder="搜索商品名称"
        @click="handleToSearsh"
      />
    </template>
    <template #default>
        <span v-if="isLoggined">{{ authorityInfo.nickname }}</span>
        <RouterLink v-else v-slot="{ navigate }" custom to="/login"><span @click="navigate">登录</span></RouterLink>
      </template>
  </AppHeader>
  <MainBannerSwiper></MainBannerSwiper>
  <MainNavsList></MainNavsList>
  <CommonList :action="getProListApi" :column="2"></CommonList>
 </div>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import MainBannerSwiper from './components/AppMainBanner/index.vue'
import MainNavsList from './components/AppMainNavsList/index.vue'
import {getProListApi} from '@/api/pro'
import {useRouter} from 'vue-router'
import useAuthorityStore from '@/stores/authority'
import { storeToRefs } from 'pinia'
const authStore = useAuthorityStore()
const { isLoggined, authorityInfo } = storeToRefs(authStore)
const value=ref<string>() 
const router=useRouter()
const handleToSearsh=()=>{
router.push({name:'searsh'})
}
</script>
<style lang="scss">

</style>